{	Problem: http://codeforces.ru/problemset/problem/102/B
	Verdict: Accepted
}
var
    t,ans:int64;
    s:string;

function get(s:String):int64;

var
    i,ls:longint;

begin
result:=0;
ls:=length(S);
for i:=1 to ls do
    inc(result,ord(s[i])-48);
end;

function gett(t:longint):longint;
begin
result:=0;
while t>0 do begin
    inc(result,t mod 10);
    t:=t div 10;
end;
end;

begin
readln(S);
if length(s) = 1 then write(0) else begin
t:=get(S);
ans:=1;
while t>=10 do begin
    t:=gett(t);
    inc(ans);
end;
write(ans);
end;
end.